const baseURL='http://localhost:8080/api';

const api={
  register:'/register',
  login:'/login',
  logout:'/logout',
  week:'/week',
  bindStuId:'/bind',
  getUser:'/user',
  getSubject:'/subject',
  createOrder:'/createOrder',
  getOrders:'/orders',
  getOrderInfo:'/order',
  receiveOrder:'/receiveOrder',
  finishOrder:'/finishOrder',
  checkOrder:'/checkOrder',
  getOrderRecords:"/orderRecords",
  getTags:'/tags',
  addTag:'/tag',
  getChatRecord:'/chatRecord'
}

let link=function(api){
  if(api!=null){
    return baseURL+api;
  }
}

var API={
  register:link(api.register),
  login:link(api.login),
  logout:link(api.logout),
  getWeek:link(api.week),
  bindStuId:link(api.bindStuId),
  getUser:link(api.getUser),
  getSubject:link(api.getSubject),
  createOrder:link(api.createOrder),
  recieveOrder:link(api.receiveOrder),
  finishOrder:link(api.finishOrder),
  checkOrder:link(api.checkOrder),
  getOrders:link(api.getOrders),
  getOrderRecords:link(api.getOrderRecords),
  getTags:link(api.getTags),
  addTag:link(api.addTag),
  getOrderInfo:link(api.getOrderInfo),
  getChatRecord:link(api.getChatRecord),
  deleteChatRecord:link(api.getChatRecord)
}

module.exports={
  API
}